package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.page.TableDataInfo;
import com.spzx.product.api.domain.ProductSku;
import com.spzx.product.api.domain.SkuPrice;
import com.spzx.product.api.domain.SkuQuery;
import com.spzx.product.api.fallback.ProductSkuFeignClientFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName ProductSkuFeignClient
 * @Author 波
 * @Date 2024/8/4 11:13
 */
@FeignClient(contextId = "productSkuFeignClient", path = "/productSku", value = ServiceNameConstants.PRODUCT_SERVICE, fallbackFactory = ProductSkuFeignClientFallbackFactory.class)
public interface ProductSkuFeignClient {

    @GetMapping("/getTopSale")
    R<List<ProductSku>> getTopSale(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/skuList")
    R<TableDataInfo> skuList(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @SpringQueryMap SkuQuery skuQuery, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @GetMapping("/getProductSku/{skuId}")
    public R<ProductSku> getProductSku(@PathVariable("skuId") Long skuId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/getSkuPrice/{skuId}")
    public R<SkuPrice> getSkuPrice(@PathVariable("skuId") Long skuId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/getSkuSpecValueMap/{pid}")
    public R<Map<String, Long>> getSkuSpecValueMap(@PathVariable("pid") Long pid, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/getSkuPriceList")
    public R<List<SkuPrice>> getSkuPriceList( List<Long> skuIdList, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
